﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Ana_Form
{
    public partial class Bos : Form
    {
        DepodataDataContext db;
        public Bos()
        {
            InitializeComponent();
            db = new DepodataDataContext();
        }


        private void markalarilistele()
        {
            listmalzeme.Items.Clear();
            var soru = from x in db.Markas orderby x.Adi select x;
            foreach (var item in soru)
            {
                ListViewItem litem = new ListViewItem();
                litem.Text = item.id.ToString();
                litem.SubItems.Add(item.Adi);
                listmalzeme.Items.Add(litem);
            }
        }

        private void lblekle_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            btnekle.Enabled = true;
            btnekle.Tag = 1;
            btnekle.Text = "Ekle";
            txtadi.Text = "";
        }

        private void lblduzenle_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            btnekle.Text = "Değiştir";
            btnekle.Tag = 0;
            btnekle.Enabled = true;
            btnsil.Enabled = true;
        }

        private void listmalzeme_SelectedIndexChanged(object sender, EventArgs e)
        {
            lblduzenle.Enabled = true;
        }


        private void btnekle_Click(object sender, EventArgs e)
        {
            if (btnekle.Tag.ToString() == "1")
            {

            }
            else
            {
            }
            db.SubmitChanges();
            markalarilistele();
            lblduzenle.Enabled = false;
            btnekle.Enabled = false;
            btnsil.Enabled = false;
        }


        private void btniptal_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btnsil_Click(object sender, EventArgs e)
        {
        }

                private void InitializeComponent()
        {
            this.listmalzeme = new System.Windows.Forms.ListView();
            this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
            this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
            this.gbmalzeme = new System.Windows.Forms.GroupBox();
            this.gbdetay = new System.Windows.Forms.GroupBox();
            this.txtadi = new System.Windows.Forms.TextBox();
            this.label1 = new System.Windows.Forms.Label();
            this.lblekle = new System.Windows.Forms.LinkLabel();
            this.lblduzenle = new System.Windows.Forms.LinkLabel();
            this.btnekle = new System.Windows.Forms.Button();
            this.btnsil = new System.Windows.Forms.Button();
            this.btniptal = new System.Windows.Forms.Button();
            this.gbmalzeme.SuspendLayout();
            this.gbdetay.SuspendLayout();
            this.SuspendLayout();
            // 
            // listmalzeme
            // 
            this.listmalzeme.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
            this.columnHeader1,
            this.columnHeader2});
            this.listmalzeme.Dock = System.Windows.Forms.DockStyle.Fill;
            this.listmalzeme.FullRowSelect = true;
            this.listmalzeme.Location = new System.Drawing.Point(3, 16);
            this.listmalzeme.MultiSelect = false;
            this.listmalzeme.Name = "listmalzeme";
            this.listmalzeme.Size = new System.Drawing.Size(263, 316);
            this.listmalzeme.TabIndex = 0;
            this.listmalzeme.UseCompatibleStateImageBehavior = false;
            this.listmalzeme.View = System.Windows.Forms.View.Details;
            this.listmalzeme.SelectedIndexChanged += new System.EventHandler(this.listmalzeme_SelectedIndexChanged);
            // 
            // columnHeader1
            // 
            this.columnHeader1.Text = "ID";
            this.columnHeader1.Width = 50;
            // 
            // columnHeader2
            // 
            this.columnHeader2.Text = "Marka";
            this.columnHeader2.Width = 192;
            // 
            // gbmalzeme
            // 
            this.gbmalzeme.Controls.Add(this.listmalzeme);
            this.gbmalzeme.Dock = System.Windows.Forms.DockStyle.Left;
            this.gbmalzeme.Location = new System.Drawing.Point(0, 0);
            this.gbmalzeme.Name = "gbmalzeme";
            this.gbmalzeme.Size = new System.Drawing.Size(269, 335);
            this.gbmalzeme.TabIndex = 1;
            this.gbmalzeme.TabStop = false;
            this.gbmalzeme.Text = "Malzemeler";
            // 
            // gbdetay
            // 
            this.gbdetay.Controls.Add(this.txtadi);
            this.gbdetay.Controls.Add(this.label1);
            this.gbdetay.Dock = System.Windows.Forms.DockStyle.Top;
            this.gbdetay.Location = new System.Drawing.Point(269, 0);
            this.gbdetay.Name = "gbdetay";
            this.gbdetay.Size = new System.Drawing.Size(261, 63);
            this.gbdetay.TabIndex = 2;
            this.gbdetay.TabStop = false;
            // 
            // txtadi
            // 
            this.txtadi.Location = new System.Drawing.Point(50, 17);
            this.txtadi.Name = "txtadi";
            this.txtadi.Size = new System.Drawing.Size(198, 20);
            this.txtadi.TabIndex = 1;
            // 
            // label1
            // 
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(7, 20);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(37, 13);
            this.label1.TabIndex = 0;
            this.label1.Text = "Marka";
            // 
            // lblekle
            // 
            this.lblekle.AutoSize = true;
            this.lblekle.Location = new System.Drawing.Point(276, 238);
            this.lblekle.Name = "lblekle";
            this.lblekle.Size = new System.Drawing.Size(85, 13);
            this.lblekle.TabIndex = 3;
            this.lblekle.TabStop = true;
            this.lblekle.Text = "Yeni Marka Ekle";
            this.lblekle.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lblekle_LinkClicked);
            // 
            // lblduzenle
            // 
            this.lblduzenle.AutoSize = true;
            this.lblduzenle.Enabled = false;
            this.lblduzenle.Location = new System.Drawing.Point(276, 266);
            this.lblduzenle.Name = "lblduzenle";
            this.lblduzenle.Size = new System.Drawing.Size(114, 13);
            this.lblduzenle.TabIndex = 3;
            this.lblduzenle.TabStop = true;
            this.lblduzenle.Text = "Seçili Markayı Düzenle";
            this.lblduzenle.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lblduzenle_LinkClicked);
            // 
            // btnekle
            // 
            this.btnekle.Enabled = false;
            this.btnekle.Location = new System.Drawing.Point(279, 301);
            this.btnekle.Name = "btnekle";
            this.btnekle.Size = new System.Drawing.Size(75, 23);
            this.btnekle.TabIndex = 4;
            this.btnekle.Text = "Değiştir";
            this.btnekle.UseVisualStyleBackColor = true;
            this.btnekle.Click += new System.EventHandler(this.btnekle_Click);
            // 
            // btnsil
            // 
            this.btnsil.Enabled = false;
            this.btnsil.Location = new System.Drawing.Point(360, 301);
            this.btnsil.Name = "btnsil";
            this.btnsil.Size = new System.Drawing.Size(75, 23);
            this.btnsil.TabIndex = 4;
            this.btnsil.Text = "Sil";
            this.btnsil.UseVisualStyleBackColor = true;
            this.btnsil.Click += new System.EventHandler(this.btnsil_Click);
            // 
            // btniptal
            // 
            this.btniptal.Location = new System.Drawing.Point(441, 301);
            this.btniptal.Name = "btniptal";
            this.btniptal.Size = new System.Drawing.Size(75, 23);
            this.btniptal.TabIndex = 4;
            this.btniptal.Text = "İptal";
            this.btniptal.UseVisualStyleBackColor = true;
            this.btniptal.Click += new System.EventHandler(this.btniptal_Click);
            // 
            // Form_Marka
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(530, 335);
            this.Controls.Add(this.btniptal);
            this.Controls.Add(this.btnsil);
            this.Controls.Add(this.btnekle);
            this.Controls.Add(this.lblduzenle);
            this.Controls.Add(this.lblekle);
            this.Controls.Add(this.gbdetay);
            this.Controls.Add(this.gbmalzeme);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
            this.Name = "Form_Marka";
            this.Text = "Marka";
            this.gbmalzeme.ResumeLayout(false);
            this.gbdetay.ResumeLayout(false);
            this.gbdetay.PerformLayout();
            this.ResumeLayout(false);
            this.PerformLayout();

        }


        private System.Windows.Forms.ListView listmalzeme;
        private System.Windows.Forms.ColumnHeader columnHeader1;
        private System.Windows.Forms.ColumnHeader columnHeader2;
        private System.Windows.Forms.GroupBox gbmalzeme;
        private System.Windows.Forms.GroupBox gbdetay;
        private System.Windows.Forms.TextBox txtadi;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.LinkLabel lblekle;
        private System.Windows.Forms.LinkLabel lblduzenle;
        private System.Windows.Forms.Button btnekle;
        private System.Windows.Forms.Button btnsil;
        private System.Windows.Forms.Button btniptal;

    }
}
